knitr::opts_chunk$set(echo = TRUE, message = FALSE, warning = FALSE)
library(tidyverse)
library(here)
library(janitor)
library(sf)
library(tmap)
This analysis visualizes California oil spill incident data for 2008, provided by the Office of Spill Prevention and Response. For this data set, an “incident” is defined as “a discharge or threatened discharge of petroleum or other deleterious material into the waters of the state”(Lampinen, 2020). The two maps included in this report are an interactive map of all 2008 spill incidents in California, and a choropleth map of all inland oil spill incidents by county.
### Read in the data
ca_counties_sf <- read_sf(here("data", "ca_counties", "CA_Counties_TIGER2016.shp")) %>%
clean_names() %>%
select(county_name = namelsad, land_area = aland)
oil_spills <- read_csv(here("data", "Oil_Spill_Incident_Tracking_[ds394].csv")) %>%
clean_names()
### Check CRS
# ca_counties_sf %>% st_crs() ### EPSG 3857, WGS 84
### Make oil_spill data frame sf
oil_spills_sf <- st_as_sf(oil_spills, coords=c("x","y"), crs = st_crs(ca_counties_sf))
tmap_mode(mode = "view")
tm_shape(ca_counties_sf) +
tm_polygons(alpha = 0.5) +
tm_shape(oil_spills_sf)+
tm_dots(col = "orange")